home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WAPPLIC.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  30.8 KB  |  921 lines

  1. /********************************************************************
  2.  *
  3.  * WApplication
  4.  *
  5.  *   Events:
  6.  *
  7.  *      AfterProcessing --
  8.  *
  9.  *      BeforeProcessing --
  10.  *
  11.  *      End -- Called when the application is terminating.
  12.  *
  13.  *      Run -- Called to run the application.
  14.  *
  15.  *      Start -- Called when the application is starting.  User can
  16.  *               decide if application should continue.
  17.  *
  18.  ********************************************************************/
  19.  
  20. #ifndef _WAPPLIC_HPP_INCLUDED
  21. #define _WAPPLIC_HPP_INCLUDED
  22. #pragma once
  23.  
  24. #ifndef _WNO_PRAGMA_PUSH
  25. #pragma pack(push,8);
  26. #pragma enum int;
  27. #endif
  28.  
  29. #include "wdef.hpp"
  30.  
  31. #ifndef _WOBJECT_HPP_INCLUDED
  32. #  include "wobject.hpp"
  33. #endif
  34. #ifndef _WBITMAP_HPP_INCLUDED
  35. #  include "wbitmap.hpp"
  36. #endif
  37. #ifndef _WSTRING_HPP_INCLUDED
  38. #  include "wstring.hpp"
  39. #endif
  40. #ifndef _WTHREAD_HPP_INCLUDED
  41. #  include "wthread.hpp"
  42. #endif
  43. #ifndef _WMODULE_HPP_INCLUDED
  44. #  include "wmodule.hpp"
  45. #endif
  46. #ifndef _WWINDOW_HPP_INCLUDED
  47. #  include "wwindow.hpp"
  48. #endif
  49. #ifndef _WLLIST_HPP_INCLUDED
  50. #  include "wllist.hpp"
  51. #endif
  52. #ifndef _WFILPATH_HPP_INCLUDED
  53. #  include "wfilpath.hpp"
  54. #endif
  55.  
  56. struct WStartEventData : public WEventData {
  57.     WBool abortRun;
  58.     WLong exitCode;
  59. };
  60.  
  61. typedef WStartEventData WEndEventData;
  62. typedef WStartEventData WRunEventData;
  63.  
  64. typedef WEventData WThreadAttachEventData;
  65. typedef WEventData WThreadDetachEventData;
  66.  
  67. struct WProcessAttachEventData : public WEventData {
  68.     WBool dynamic;
  69. };
  70.  
  71. typedef WProcessAttachEventData WProcessDetachEventData;
  72.  
  73.  
  74. enum WWaitReturn {
  75.     WFailed                     = 0xFFFFFFFFL,
  76.     WSucceeded                  = 0x00000000L,
  77.     WAbandoned                  = 0x00000080L,
  78.     WTimeout                    = 0x00000102L
  79. };
  80.  
  81. enum WReadingDirection {
  82.     WReadRightToLeft,
  83.     WReadLeftToRight,
  84.     WReadGuess
  85. };
  86.  
  87. class WForm;
  88.  
  89. enum WHelpType {
  90.     WHelpContext                = 0x0001,
  91.     WHelpQuit                   = 0x0002,
  92.     WHelpIndex                  = 0x0003,
  93.     WHelpContents               = 0x0003,
  94.     WHelpHelpOnHelp             = 0x0004,
  95.     WHelpSetContents            = 0x0005,
  96.     WHelpSetIndex               = 0x0005,
  97.     WHelpContextPopup           = 0x0008,
  98.     WHelpOnContextMenu          = 0x000a,
  99.     WHelpFinder                 = 0x000b,
  100.     WHelpOnHelp                 = 0x000c,
  101.     WHelpKey                    = 0x0101,
  102.     WHelpCommand                = 0x0102,
  103.     WHelpPartialKey             = 0x0105
  104. };
  105.  
  106. #define WClipboardText                  WTEXT("WCLASS_CLIPBOARD_TEXT")
  107. #define WClipboardDIF                   WTEXT("WCLASS_CLIPBOARD_DIF")
  108. #define WClipboardBitmap                WTEXT("WCLASS_CLIPBOARD_BITMAP")
  109. #define WClipboardDIBitmap              WTEXT("WCLASS_CLIPBOARD_DI_BITMAP")
  110. #define WClipboardDSPBitmap             WTEXT("WCLASS_CLIPBOARD_DSP_BITMAP")
  111. #define WClipboardOEMText               WTEXT("WCLASS_CLIPBOARD_OEM_TEXT")
  112. #define WClipboardUnicodeText           WTEXT("WCLASS_CLIPBOARD_UNICODE_TEXT")
  113. #define WClipboardTIFF                  WTEXT("WCLASS_CLIPBOARD_TIFF")
  114. #define WClipboardWave                  WTEXT("WCLASS_CLIPBOARD_WAVE")
  115. #define WClipboardSYLK                  WTEXT("WCLASS_CLIPBOARD_SYLK")
  116. #define WClipboardRIFF                  WTEXT("WCLASS_CLIPBOARD_RIFF")
  117. #define WClipboardPenData               WTEXT("WCLASS_CLIPBOARD_PEN_DATA")
  118. #define WClipboardPalette               WTEXT("WCLASS_CLIPBOARD_PALETTE")
  119. #define WClipboardOwnerDisplay          WTEXT("WCLASS_CLIPBOARD_OWNER_DISPLAY")
  120. #define WClipboardMetaFile              WTEXT("WCLASS_CLIPBOARD_META_FILE")
  121. #define WClipboardLocale                WTEXT("WCLASS_CLIPBOARD_LOCALE")
  122. #define WClipboardHDROP                 WTEXT("WCLASS_CLIPBOARD_HDROP")
  123. #define WClipboardDSPText               WTEXT("WCLASS_CLIPBOARD_DSP_TEXT")
  124. #define WClipboardDSPMetaFile           WTEXT("WCLASS_CLIPBOARD_DSP_META_FILE")
  125. #define WClipboardEnhancedMetaFile      WTEXT("WCLASS_CLIPBOARD_EN_META_FILE")
  126. #define WClipboardDSPEnhancedMetaFile   WTEXT("WCLASS_CLIPBOARD_DSP_EN_META_FILE")
  127.  
  128. typedef WBool WCMDEF (WObject::*WEnumCallback)( WWindow * win,
  129.                                                 WWindowHandle winHandle,
  130.                                                 void * userData );
  131.  
  132. #ifndef _WIN16
  133. #undef FindExecutable
  134. #undef ExtractIcon
  135. #undef GetFileAttributes
  136. #undef SetFileAttributes
  137. #undef GetUserName
  138. #undef GetComputerName
  139. #undef GetCommandLine
  140. #undef SendMessage
  141. #undef PostMessage
  142. #undef PlaySound
  143. #undef GetSystemDirectory
  144. #undef GetWindowsDirectory
  145. #undef GetWorkingDirectory
  146. #undef CopyFile
  147. #undef MoveFile
  148. #undef DeleteFile
  149. #undef InitiateSystemShutdown
  150. #undef GetEnvironmentVariable
  151. #undef SetEnvironmentVariable
  152. #if defined( _UNICODE )
  153.     #define GetUserName                 GetUserNameW
  154.     #define GetComputerName             GetComputerNameW
  155.     #define GetCommandLine              GetCommandLineW
  156.     #define GetEnvironmentVariable      GetEnvironmentVariableW
  157.     #define SetEnvironmentVariable      SetEnvironmentVariableW
  158.     #define SendMessage                 SendMessageW
  159.     #define PostMessage                 PostMessageW
  160.     #define PlaySound                   PlaySoundW
  161.     #define GetSystemDirectory          GetSystemDirectoryW
  162.     #define GetWindowsDirectory         GetWindowsDirectoryW
  163.     #define GetWorkingDirectory         GetWorkingDirectoryW
  164.     #define SetFileAttributes           SetFileAttributesW
  165.     #define CopyFile                    CopyFileW
  166.     #define MoveFile                    MoveFileW
  167.     #define DeleteFile                  DeleteFileW
  168.     #define InitiateSystemShutdown      InitiateSystemShutdownW
  169.     #define GetFileAttributes           GetFileAttributesW
  170.     #define FindExecutable              FindExecutableW
  171.     #define ExtractIcon                 ExtractIconW
  172.     #define GetProfileString            GetProfileStringW
  173.     #define WritePrivateProfileString   WritePrivateProfileStringW
  174. #else
  175.     #define GetUserName                 GetUserNameA
  176.     #define GetComputerName             GetComputerNameA
  177.     #define GetCommandLine              GetCommandLineA
  178.     #define GetEnvironmentVariable      GetEnvironmentVariableA
  179.     #define SetEnvironmentVariable      SetEnvironmentVariableA
  180.     #define SendMessage                 SendMessageA
  181.     #define PostMessage                 PostMessageA
  182.     #define PlaySound                   PlaySoundA
  183.     #define GetSystemDirectory          GetSystemDirectoryA
  184.     #define GetWindowsDirectory         GetWindowsDirectoryA
  185.     #define GetWorkingDirectory         GetWorkingDirectoryA
  186.     #define GetFileAttributes           GetFileAttributesA
  187.     #define SetFileAttributes           SetFileAttributesA
  188.     #define CopyFile                    CopyFileA
  189.     #define MoveFile                    MoveFileA
  190.     #define DeleteFile                  DeleteFileA
  191.     #define InitiateSystemShutdown      InitiateSystemShutdownA
  192.     #define FindExecutable              FindExecutableA
  193.     #define ExtractIcon                 ExtractIconA
  194.     #define GetProfileString            GetProfileStringA
  195.     #define WritePrivateProfileString   WritePrivateProfileStringA
  196. #endif
  197. #endif
  198.  
  199. enum WBeepSound {
  200.     WBeepOK             = 0x00000000L,          WBeepDefault = WBeepOK,
  201.     WBeepHand           = 0x00000010L,
  202.     WBeepQuestion       = 0x00000020L,
  203.     WBeepExclamation    = 0x00000030L,
  204.     WBeepAsterisk       = 0x00000040L,
  205.     WBeepStandard       = 0xFFFFFFFF,
  206. };
  207.  
  208.  
  209. #define    WPSFlagSync          0x0000 // SND_SYNC
  210. #define    WPSFlagAsync         0x0001 // SND_ACYNC
  211. #define    WPSFlagNoDefault     0x0002 // SND_NODEFAULT
  212. #define    WPSFlagMemory        0x0004 // SND_MEMORY
  213. #define    WPSFlagLoop          0x0008 // SND_LOOP
  214. #define    WPSFlagNoStop        0x0010 // SND_NOSTOP
  215.  
  216. #define    WPSFlagNoWait        0x00002000L // SND_NOWAIT
  217. #define    WPSFlagAlias         0x00010000L // SND_ALIAS
  218. #define    WPSFlagAliasID       0x00110000L // SND_ALIAS_ID
  219. #define    WPSFlagFileName      0x00020000L // SND_FILENAME
  220. #define    WPSFlagResource      0x00040004L // SND_RESOURCE
  221. #if(WINVER >= 0x0400)
  222. #define    WPSFlagPurge         0x0040 // SND_PURGE
  223. #define    WPSFlagApplication   0x0080 // SND_APPLICATION
  224. #endif /* WINVER > = 0x0400 */
  225.  
  226.  
  227. struct WOSVersionInfo {
  228.     WDWord platform;
  229.     WDWord majorVersion;
  230.     WDWord minorVersion;
  231.     WDWord buildNumber;
  232.     WChar  extraInfo[ 128 ];
  233.     WDWord reserved;
  234. };
  235.  
  236. class WCMCLASS WTime {
  237.         public:
  238.             WTime();
  239.             WTime( double date );
  240.             ~WTime();
  241.  
  242.             WCMRETURNSFLOAT operator double() const;
  243.  
  244.         public:    
  245.             WUShort _year;
  246.             WUShort _month;
  247.             WUShort _dayOfWeek;
  248.             WUShort _day;
  249.             WUShort _hour;
  250.             WUShort _minute;
  251.             WUShort _second;
  252.             WUShort _milliseconds;
  253. };
  254.  
  255. enum WOSType {
  256.     WOST_Win16 = 0,
  257.     WOST_WinNT = 1,
  258.     WOST_Win95 = 2,
  259.     WOST_Win32s = 3,
  260. };
  261.  
  262.  
  263. typedef WULong WSHFileFlag;
  264.  
  265. #define WSFFMultiDestFiles              ((WSHFileFlag)0x00000001L)
  266. #define WSFFMultiDestinationFiles       ((WSHFileFlag)0x00000001L)
  267. #define WSFFMultipleDestFiles           ((WSHFileFlag)0x00000001L)
  268. #define WSFFMultipleDestinationFiles    ((WSHFileFlag)0x00000001L)
  269. #define WSFFConfirmMouse                ((WSHFileFlag)0x00000002L)
  270. #define WSFFSilent                      ((WSHFileFlag)0x00000004L)
  271. #define WSFFRenameOnCollision           ((WSHFileFlag)0x00000008L)
  272. #define WSFFNoConfirmation              ((WSHFileFlag)0x00000010L)
  273. #define WSFFWantMappingHandle           ((WSHFileFlag)0x00000020L)
  274. #define WSFFAllowUndo                   ((WSHFileFlag)0x00000040L)
  275. #define WSFFFilesOnly                   ((WSHFileFlag)0x00000080L)
  276. #define WSFFSimpleProgress              ((WSHFileFlag)0x00000100L)
  277. #define WSFFNoConfirmMkdir              ((WSHFileFlag)0x00000200L)
  278. #define WSFFNoConfirmMakeDir            ((WSHFileFlag)0x00000200L)
  279. #define WSFFNoConfirmMakeDirectory      ((WSHFileFlag)0x00000200L)
  280.  
  281. #define WSFFDefaultCopy                 ((WSHFileFlag)0x0000025CL)
  282. #define WSFFDefaultMove                 ((WSHFileFlag)0x0000025CL)
  283. #define WSFFDefaultDelete               ((WSHFileFlag)0x0000025CL)
  284. #define WSFFDefaultRename               ((WSHFileFlag)0x0000025CL)
  285.  
  286. typedef WULong WFileAttribute;
  287.  
  288. #define WFAReadOnly                     ((WFileAttribute)0x00000001L)
  289. #define WFAHidden                       ((WFileAttribute)0x00000002L)
  290. #define WFASystem                       ((WFileAttribute)0x00000004L)
  291. #define WFADirectory                    ((WFileAttribute)0x00000010L)
  292. #define WFAArchive                      ((WFileAttribute)0x00000020L)
  293. #define WFANormal                       ((WFileAttribute)0x00000080L)
  294. #define WFATemporary                    ((WFileAttribute)0x00000100L)
  295. #define WFACompressed                   ((WFileAttribute)0x00000800L)
  296.  
  297. enum WExecutableFileType {
  298.     WNonEXE,
  299.     WWindowsEXE,
  300.     WDosEXE,
  301.     WWin32ConsoleEXE
  302. };
  303.  
  304. //
  305. // WApplication
  306. //
  307.  
  308. #define WAppObject (*WApplication::GetApplicationObject())
  309.  
  310. class WCMCLASS WApplication : public WEventGenerator {
  311.     WDeclareSubclass( WApplication, WEventGenerator );
  312.  
  313.     public:
  314.  
  315.         /***************************************************************
  316.          * Constructors and Destructors
  317.          ****************************************************************/
  318.  
  319.         WApplication();
  320.  
  321.         ~WApplication();
  322.  
  323.         /***************************************************************
  324.          * Properties
  325.          ***************************************************************/
  326.  
  327.         // AutomaticContextHelpHandling
  328.  
  329.         WBool GetAutomaticContextHelpHandling() const;
  330.         WBool SetAutomaticContextHelpHandling( WBool autoContextHelp );
  331.  
  332.         // ClipboardBitmap
  333.         //
  334.         // NOTE: On the Set, the bmp must have its handle detached first.
  335.         //       This can be accomplished by calling bmp.DetachHandle().
  336.         // NOTE: On the Get, the bitmap that is returned cannot be
  337.         //       relied upon for long-term use, so the best idea is to
  338.         //       make a copy of it, as in bmp.Create( bmp, 0, 0, TRUE );
  339.  
  340.         WBool   SetClipboardBitmap( const WBitmap & bmp, WWindow *owner=NULL );
  341.         WBitmap GetClipboardBitmap( WWindow * owner=NULL );
  342.  
  343.         // ClipboardData
  344.         //
  345.         // NOTE: Can't rely on return value of GetClipboardData for
  346.         //       long-term use, so the best idea is to make a copy of it
  347.  
  348.         WBool SetClipboardData( void * data, WInt data_size,
  349.                                 const WChar * format,
  350.                                 WWindow * owner=NULL, WBool indirect=TRUE );
  351.         WBool SetClipboardData( void * data, WInt data_size, WInt format,
  352.                                 WWindow * owner=NULL, WBool indirect=TRUE );
  353.         void * GetClipboardData( const WChar * format, WWindow * owner=NULL,
  354.                                  WBool indirect=TRUE );
  355.         void * GetClipboardData( WInt format, WWindow * owner=NULL,
  356.                                  WBool indirect=TRUE );
  357.  
  358.         // ClipboardText
  359.  
  360.         WBool SetClipboardText( const WString & str, WWindow * owner=NULL );
  361.         WString GetClipboardText( WWindow * owner=NULL );
  362.  
  363.         // HelpFile
  364.         //
  365.         //     Identifies the module-wide help file.
  366.  
  367.         WFilePath GetHelpFile() const;
  368.         WBool     SetHelpFile( const WFilePath & helpFile );
  369.  
  370.         // LocalModule
  371.         //
  372.         //     Identifies the module that created the application
  373.         //     object.  In a EXE, the local module is either the
  374.         //     exe module or the library module.  In a DLL, the
  375.         //     local module is either the library module or a
  376.         //     completely different module.
  377.  
  378.         const WModule & GetLocalModule() const;
  379.  
  380.         // MultiOSWarnings
  381.  
  382.         WBool GetMultiOSWarnings() const;
  383.         WBool SetMultiOSWarnings( WBool warnings );
  384.  
  385.         // ReadingDirection
  386.  
  387.         WReadingDirection GetReadingDirection( void ) const;
  388.         void SetReadingDirection( WReadingDirection );
  389.  
  390.         /*************************************************************
  391.          * Methods
  392.          *************************************************************/
  393.  
  394.         // EmptyClipboard
  395.  
  396.         WBool EmptyClipboard( WWindow * owner=NULL );
  397.  
  398.         // Initialize 
  399.         //
  400.         //    Call this to initialize the library.  Appropriate defaults
  401.         //    are used.
  402.  
  403.         WBool Initialize( unsigned int instance,
  404.                           unsigned int prevInstance,
  405.                           const WAnsiChar *commandLine, int showState );
  406.         WBool Initialize( WModuleHandle instance=0,
  407.                           WModuleHandle prevInstance=0,
  408.                           WAnsiChar *commandLine=NULL, int showState=0 );
  409.  
  410.         // Quit
  411.  
  412.         void Quit( WDWord exitCode=0 );
  413.  
  414.         // Run 
  415.  
  416.         WLong Run();
  417.  
  418.         // Uninitialize
  419.  
  420.         WLong Uninitialize();
  421.  
  422.         /*************************************************************
  423.          * Static Properties
  424.          *************************************************************/
  425.  
  426.         // ActiveWindow
  427.  
  428.         static WWindow *GetActiveWindow();
  429.         static WBool    SetActiveWindow( WWindow *win );
  430.  
  431.         // ApplicationObject
  432.  
  433.         static WApplication *GetApplicationObject();
  434.         static WBool         SetApplicationObject( WApplication * appObj );
  435.  
  436.         // CaptionSize
  437.  
  438.         static WInt GetCaptionSize();
  439.  
  440.         // CommandLine
  441.         //
  442.         //     Return the command line used to start the app.
  443.  
  444.         static WString GetCommandLine();
  445.  
  446.         // GetWorkArea
  447.  
  448.         static WRect GetWorkArea();
  449.  
  450.         // ComputerName
  451.         //
  452.         //     Name of this computer.
  453.  
  454.         static WString GetComputerName();
  455.  
  456.         // DesktopWindowHandle
  457.  
  458.         static WWindowHandle GetDesktopWindowHandle();
  459.  
  460.         // DialogBaseWidth
  461.  
  462.         static WFloat WCMRETURNSFLOAT GetDialogBaseHeight( const WFont & font );
  463.  
  464.         // DialogBaseWidth
  465.  
  466.         static WFloat WCMRETURNSFLOAT GetDialogBaseWidth( const WFont & font );
  467.  
  468.         // DialogFrameHeight
  469.  
  470.         static WInt GetDialogFrameHeight();
  471.     
  472.         // DialogFrameWidth
  473.  
  474.         static WInt GetDialogFrameWidth();
  475.  
  476.         // EnvironmentVariable
  477.  
  478.         static WString GetEnvironmentVariable( const WString & name );
  479.         static WBool   SetEnvironmentVariable( const WString & name,
  480.                                                const WString & value );
  481.  
  482.         // ExecutableModule
  483.         //
  484.         //     Identifies the EXE's module.
  485.  
  486.         static const WModule & GetExecutableModule();
  487.  
  488.         // ExecutableType
  489.  
  490.         static WExecutableFileType GetExecutableType( const WFilePath & exe );
  491.  
  492.         // FileAttributes
  493.  
  494.         static WFileAttribute GetFileAttributes( const WFilePath & file );
  495.         static WBool SetFileAttributes( const WFilePath & file,
  496.                                         WFileAttribute attribute=0 );
  497.  
  498.         // FileDisplayName
  499.  
  500.         static WString GetFileDisplayName( const WFilePath & file,
  501.                                            WBool useFileAttributes=FALSE,
  502.                                            WFileAttribute attribute=0 );
  503.  
  504.         // FileType
  505.  
  506.         static WString GetFileType( const WFilePath & file,
  507.                                     WBool useFileAttributes=FALSE,
  508.                                     WFileAttribute attribute=0 );
  509.  
  510.         // FocusWindow
  511.  
  512.         static WWindow * GetFocusWindow();
  513.  
  514.         // ForegroundWindow
  515.  
  516.         static WBool SetForegroundWindow( WWindow * window );
  517.         static WWindow * GetForegroundWindow();
  518.  
  519.         // ForegroundWindowHandle
  520.  
  521.         static WWindowHandle GetForegroundWindowHandle();
  522.  
  523.         // FrameHeight
  524.  
  525.         static WInt GetFrameHeight();
  526.     
  527.         // FrameWidth
  528.  
  529.         static WInt GetFrameWidth();
  530.     
  531.         // HScrollBarHeight
  532.  
  533.         static WInt GetHScrollBarHeight();
  534.  
  535.         // KeyboardState
  536.  
  537.         static WULong GetKeyboardState();
  538.  
  539.         // LibraryModule
  540.         //
  541.         //     Identifies the WClass DLL's module.  Note that in a
  542.         //     standalone exe LibraryModule == ExecutableModule.
  543.  
  544.         static const WModule & GetLibraryModule();
  545.  
  546.         // MousePresent
  547.  
  548.         static WBool GetMousePresent();
  549.  
  550.         // MenuCheckMarkHeight
  551.  
  552.         static WInt GetMenuCheckMarkHeight();
  553.     
  554.         // MenuCheckMarkWidth
  555.  
  556.         static WInt GetMenuCheckMarkWidth();
  557.     
  558.         // ProfileString
  559.         //
  560.         //    Write/read strings out of a .INI file, used for
  561.         //    backwards compatibility with Win 3.1 programs.
  562.         //    You should use BroadcastProfileChange when you
  563.         //    modify the system file.
  564.  
  565.         static WString GetProfileString( WString sectionName, WString keyName,
  566.                                          WString defaultString,
  567.                                          WString fileName = "WIN.INI" );
  568.                                          
  569.         static WBool SetProfileString( WString sectionName, WString keyName,
  570.                                        WString value,
  571.                                        WString fileName = "WIN.INI",
  572.                                        WBool flushCache = TRUE );
  573.  
  574.         // ProgramPath
  575.         //
  576.         //     Return the full path to the running executable.
  577.  
  578.         static WString GetProgramPath();
  579.  
  580.         // ScreenSize
  581.  
  582.         static WRect GetScreenSize();
  583.  
  584.         // SystemDirectory
  585.         //
  586.         //     Returns path of the system directory.
  587.  
  588.         static WString GetSystemDirectory();
  589.  
  590.         // SystemTime
  591.         //
  592.         //
  593.         static WTime GetSystemTime();
  594.  
  595.         // UserName
  596.         //
  597.         //     User's login name.
  598.  
  599.         static WString GetUserName();
  600.  
  601.         // VScrollBarWidth
  602.  
  603.         static WInt GetVScrollBarWidth();
  604.  
  605.         // WindowsDirectory
  606.         //
  607.         //     Returns path of the Windows directory.
  608.  
  609.         static WString GetWindowsDirectory();
  610.  
  611.         // WorkingDirectory
  612.         //
  613.         //     Return the full path of the current directory.
  614.  
  615.         static WString GetWorkingDirectory();
  616.  
  617.         /*************************************************************
  618.          * Static Methods
  619.          *************************************************************/
  620.  
  621.         // AbortSystemShutdown
  622.  
  623.         static WBool AbortSystemShutdown( WChar * machineName=NULL );
  624.  
  625.         // AddObject
  626.  
  627.         static WBool AddObject( WObject *object, const WString & objectName );
  628.  
  629.         // AddToRecentDocumentList
  630.  
  631.         static void AddToRecentDocumentList( const WFilePath & file );
  632.  
  633.         // Beep
  634.  
  635.         static WBool Beep( WBeepSound sound=WBeepStandard );
  636.  
  637.         // BroadcastProfileChange
  638.         //
  639.         //    Use this to broadcast a message to all top-level
  640.         //    windows indicating the WIN.INI file was changed.
  641.  
  642.         static WBool BroadcastProfileChange();
  643.  
  644.         // ClearRecentDocumentList
  645.  
  646.         static void ClearRecentDocumentList();
  647.  
  648.         // CopyFile
  649.  
  650.         static WBool CopyFile( const WFilePath & source,
  651.                                const WFilePath & dest, WWindow * parent=NULL,
  652.                                WSHFileFlag flags=WSFFDefaultCopy,
  653.                                const WChar * progressTitle=NULL,
  654.                                WBool * userAborted=NULL );
  655.  
  656.         // DeleteFile
  657.  
  658.         static WBool DeleteFile( const WFilePath & source,
  659.                                  WWindow * parent=NULL,
  660.                                  WSHFileFlag flags=WSFFDefaultDelete,
  661.                                  const WChar * progressTitle=NULL,
  662.                                  WBool * userAborted=NULL );
  663.  
  664.         // EnumerateAllWindows
  665.  
  666.         static WBool EnumerateAllWindows( WObject * client,
  667.                                           WEnumCallback callback,
  668.                                           void * userData );
  669.  
  670.         // EnumerateChildWindows
  671.  
  672.         static WBool EnumerateChildWindows( WObject * client,
  673.                                             WEnumCallback callback,
  674.                                             void * userData,
  675.                                             WWindow * parent );
  676.  
  677.         // EnumerateTopLevelWindows
  678.  
  679.         static WBool EnumerateTopLevelWindows( WObject * client,
  680.                                                WEnumCallback callback,
  681.                                                void * userData );
  682.  
  683.         // Execute
  684.  
  685.         static WBool Execute(const WFilePath & file,
  686.                              const WString & operation = WNullString,
  687.                              const WString & parameters = WEmptyString,
  688.                              WInt cmdShow = WWinStateShowNormal,
  689.                              WWindow* parent = NULL);
  690.  
  691.         // ExtractIcon
  692.  
  693.         static WIcon ExtractIcon(const WFilePath & file,
  694.                                  WBool associated = TRUE,
  695.                                  WUInt index = 0);
  696.  
  697.         // FindExecutable
  698.  
  699.         static WBool FindExecutable(const WFilePath & file,  WString & nameEXE);
  700.  
  701.         // FindObject
  702.  
  703.         static WObject *FindObject( const WString & objectName,
  704.                                     WClassID id=0 );
  705.  
  706.         // ForceDelete
  707.  
  708.         static void ForceDelete( WBool evenInEventHandler=FALSE,
  709.                                  WObject * calledFrom=NULL );
  710.  
  711.         // InitiateSystemShutdown
  712.  
  713.         static WBool InitiateSystemShutdown( WChar * message=NULL,
  714.                                              WLong timeout=0,
  715.                                              WBool forceAppsToClose=TRUE,
  716.                                              WBool reboot=FALSE,
  717.                                              WChar * machineName=NULL );
  718.  
  719.         // InvokeHelp
  720.         //
  721.         //    Invoke the help subsystem.  A form is required for the
  722.         //    help subsystem to keep track of help requests.  If no
  723.         //    filename is specified, the file in the HelpFile property
  724.         //    is used instead.
  725.  
  726.         static WBool InvokeHelp( WWindow * window, WHelpType type,
  727.                           WULong helpID, const WChar * helpFileName=NULL,
  728.                           WWindowHandle windowHandle=NULLHWND );
  729.         static WBool InvokeHelp( WWindow * window, WHelpType type,
  730.                           const WChar * helpCommand,
  731.                           const WChar * helpFileName=NULL );
  732.  
  733.         // MoveFile
  734.  
  735.         static WBool MoveFile( const WFilePath & source,
  736.                                const WFilePath & dest,
  737.                                WWindow * parent=NULL,
  738.                                WSHFileFlag flags=WSFFDefaultMove,
  739.                                const WChar * progressTitle=NULL,
  740.                                WBool * userAborted=NULL );
  741.  
  742.         // MultiOSWarning
  743.  
  744.         static void MultiOSWarning( WOSType os, WChar * message );
  745.  
  746.         // OSType
  747.         //
  748.         //    Return the type of OS we're running on (NT, Win95, Win16,
  749.         //    or Win32s) and optionally fill in a WOSVersionInfo
  750.         //    structure.
  751.  
  752.         static WOSType OSType( WOSVersionInfo *info=NULL );
  753.  
  754.         // PlaySound (WAVEFORM sound file format)
  755.  
  756.         static WBool PlaySound( const WString & sound,
  757.                                 WULong flag=WPSFlagFileName|WPSFlagAsync,
  758.                                 WModuleHandle module=_ApplicationModule );
  759.  
  760.         // PostMessage
  761.  
  762.         static WLong PostMessage( WWindow * win, const WMessage & msg );
  763.         static WLong PostMessage( const WMessage & msg );
  764.  
  765.         // RegisterDeleteObject (alternative to delete this)
  766.  
  767.         static WBool RegisterDeleteObject( WObject * object );
  768.  
  769.         // RemoveObject
  770.  
  771.         static WBool RemoveObject( WObject *object );
  772.         static WBool RemoveObject( const WString & objectName, WClassID id=0 );
  773.  
  774.         // RenameFile
  775.  
  776.         static WBool RenameFile( const WFilePath & source,
  777.                                  const WFilePath & dest,
  778.                                  WWindow * parent=NULL,
  779.                                  WSHFileFlag flags=WSFFDefaultRename,
  780.                                  const WChar * progressTitle=NULL,
  781.                                  WBool * userAborted=NULL );
  782.  
  783.         // SendMessage
  784.  
  785.         static WLong SendMessage( WWindow * win, const WMessage & msg );
  786.         static WLong SendMessage( const WMessage & msg );
  787.  
  788.         // Wait
  789.         //
  790.         //    Wait for semaphore, thread, process, et. al.
  791.  
  792.         static WWaitReturn Wait( WULong handle, WULong secondsToWait=0,
  793.                                  WBool waitForever=FALSE );
  794.  
  795.         /*************************************************************
  796.          * Other
  797.          *************************************************************/
  798.  
  799.         virtual WBool SetEventHandler( WEventID id, WObject * object,
  800.                                        WEventHandler handler,
  801.                                        void * userdata=NULL,
  802.                                        WInt * index=NULL );
  803.  
  804.         /*************************************************************
  805.          * Data members
  806.          *************************************************************/
  807.  
  808.     #ifdef __BUILDING_WCM__
  809.     public:
  810.     #else
  811.     protected:
  812.     #endif
  813.  
  814.         WStartEventData         _event;
  815.         WModule                 _localModule;
  816.         WFilePath              *_helpFile;
  817.         WDWord                  _mainThreadID;
  818.         WBool                   _multiOSWarnings;
  819.         WBool                   _autoContextHelp;
  820.         WReadingDirection       _readingDir;
  821.  
  822.         static WApplication    *_globalObject;
  823.         static WModule          _libraryModule;
  824.         static WModule          _exeModule;
  825. };
  826.  
  827. class WCMCLASS WExeApplication : public WApplication {
  828.     WDeclareSubclass( WExeApplication, WApplication );
  829.  
  830.     public:
  831.         WExeApplication();
  832.  
  833.         ~WExeApplication();
  834.  
  835.         /*************************************************************
  836.          * Methods
  837.          *************************************************************/
  838.  
  839.         // EntryPoint
  840.         //
  841.         //     Note that the second just calls the first and is provided
  842.         //     for backwards compatibility.
  843.  
  844.         int EntryPoint( WModuleHandle inst, WModuleHandle prev,
  845.                         WAnsiChar *command, int show );
  846.         int EntryPoint( unsigned int inst, unsigned int prev,
  847.                         const WAnsiChar *command, int show );
  848.  
  849.         /*************************************************************
  850.          * Data members
  851.          *************************************************************/
  852.     private:
  853. };
  854.  
  855. /********************************************************************
  856.  *
  857.  * WDLLApplication
  858.  *
  859.  *   Events:
  860.  *
  861.  *      ProcessAttach --
  862.  *
  863.  *      ProcessDetach --
  864.  *
  865.  *      ThreadAttach --
  866.  *
  867.  *      ThreadDetach --
  868.  *
  869.  ********************************************************************/
  870.  
  871. class WCMCLASS WDLLApplication : public WApplication {
  872.     WDeclareSubclass( WDLLApplication, WApplication );
  873.  
  874.     public:
  875.         WDLLApplication();
  876.  
  877.         ~WDLLApplication();
  878.  
  879.         /*************************************************************
  880.          * Methods
  881.          *************************************************************/
  882.  
  883.         // EntryPoint
  884.         //
  885.         //     Note that the second just calls the first and is provided
  886.         //     for backwards compatibility.
  887.  
  888.         WBool EntryPoint( WModuleHandle inst, unsigned int reason,
  889.                           void * data );
  890.         WBool EntryPoint( unsigned int inst, unsigned int reason,
  891.                           void * data );
  892.  
  893.         /*************************************************************
  894.          * Data members
  895.          *************************************************************/
  896.     private:
  897. };
  898.  
  899. #if defined( _DEBUG ) && defined( __BUILDING_WCM__ )
  900. #define WMULTIOSWARNING( os, msg ) \
  901.                 if( WApplication::_globalObject && \
  902.                     WApplication::_globalObject->_multiOSWarnings && \
  903.                     ___WCMOSVersion == os ){ \
  904.                     WApplication::MultiOSWarning( os, msg );\
  905.                 }
  906. #elif defined( _DEBUG )
  907. #define WMULTIOSWARNING( os, msg )                                      \
  908.                 if( WApplication::GetApplicationObject() != NULL && WApplication::GetApplicationObject()->GetMultiOSWarnings() && WApplication::OSType() == os ) {      \
  909.                     WApplication::MultiOSWarning( os, msg );            \
  910.                 }
  911. #else
  912. #define WMULTIOSWARNING( os, msg )
  913. #endif
  914.  
  915. #ifndef _WNO_PRAGMA_PUSH
  916. #pragma enum pop;
  917. #pragma pack(pop);
  918. #endif
  919.  
  920. #endif // _WAPPLIC_HPP_INCLUDED
  921.